<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\admin\model\general\Article;
use app\admin\model\general\PayList;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    /**
     * 首页
     *
     */
    public function index()
    {
        $this->success('请求成功');
    }

    public function article(){
        $model_temp = new Article();
        $filter['status'] = 'normal';
        $listdata = $model_temp->where($filter)->order('weigh desc')->select();
        $this->success('请求成功',$listdata);
    }

    public function article_detail($id){
        $model_temp = new Article();
        $filter['id'] = $id;
        $filter['status'] = 'normal';
        $listdata = $model_temp->where($filter)->find();
        $this->success('请求成功',$listdata);
    }

    //支付列表
    public function pay_list(){
//        $model_temp = new PayList();
        $filter['status'] = 'normal';
        $listdata = \think\Db::name('pay_method')->field('id,title,image,code')->where($filter)->order('weigh desc')->select();
        foreach ($listdata as $k=>$v){
            $listdata[$k]['image'] = cdnurl($v['image'],true);
        }
        $this->success('请求成功',$listdata);
    }

}
